package date0709am;

import java.sql.SQLException;
import java.time.LocalDate;

import cn.edu.ecut.util.DatabaseType;
import cn.edu.ecut.util.JdbcHelper;

public class JdbcTest32 {

	public static void main(String[] args) throws SQLException {
		
		Student s = new Student();
		s.setId( 2002 );
		s.setName( "毛宁" );
		s.setGender( '男' );
		s.setBirthdate( LocalDate.of( 1972 , 10 , 11 ) );
		System.out.println( s );
		
		JdbcHelper h = JdbcHelper.getInstance( DatabaseType.ORACLE );
		
		String sql = "INSERT INTO t_students ( name , gender , birthdate , id ) VALUES (?,?,?,?)" ;
		String g = String.valueOf( s.getGender() ) ;
		java.sql.Date d = java.sql.Date.valueOf( s.getBirthdate() );
		int count = h.update( sql , s.getName() ,  g , d , s.getId() );
		System.out.println( count );
		
		h.release();
		
	}

}
